/**
 * @(#)Main.java 2011-8-24 Copyright 2011 it.kedacom.com, Inc. All rights
 *               reserved.
 */

package com.kedacom.xmpp.demo.oneserver.chat;

import java.util.Collection;

import org.jivesoftware.smack.ChatManagerListener;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.RosterListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.packet.Presence;



 /**
  * (用一句话描述类的主要功能)
  * @author 何霄刚  
  * @date 2011-12-20
  */
 
public class User2Multicast {

	/**
	 * (用一句话描述方法的主要功能)
	 * @param args
	 * @throws XMPPException
	 * @throws InterruptedException
	 */

	public static void main(String[] args) throws XMPPException, InterruptedException {
		String SERVER = "ts.local", USER = "xiaojinghai", PASS = "888";

		// 登录
		XMPPConnection conn = new XMPPConnection(SERVER);
		conn.connect();
		conn.login(USER, PASS, null);
		System.out.println("xiaojinghai已登录!");
		
		conn.addPacketListener(new PacketListener(){

			@Override
			public void processPacket(Packet packet) {
				System.out.println("<--	"+packet.toXML());
			}
			
		}, null);
		conn.addPacketSendingListener(new PacketListener(){

			@Override
			public void processPacket(Packet packet) {
				System.out.println("-->	"+packet.toXML());
			}
			
		}, null);
		
		Thread.currentThread().suspend();
	}

}
